import { createRouter, createWebHistory } from 'vue-router'
import { defaultRouters, devRouters } from './config'

const isDev = import.meta.env.DEV
const routerHistory = createWebHistory()
const routes = isDev ? [...defaultRouters, ...devRouters] : defaultRouters

export const router = createRouter({
  history: routerHistory,
  routes,
})

export function setupRouter(app) {
  app.use(router)
}
